import { DeviceState } from '@CONSTANTS/BleConstants'
import { DeviceStatusFlags } from '@TYPES/BleTypes'

interface Props {
  state?: DeviceState
  flags?: DeviceStatusFlags,
  treatmentElapsedTimeInSeconds?: number
  treatmentTimeLeftInSeconds?: number
  treatmentActualIntensityInPercentage?: number
  treatmentConfiguredIntensityInPercentage?: number
  pauseRemainingTimeInSeconds?: number
  numberOfTreatments?: number
  numberOfPauseTreatmentsLeft?: number
}

export default class DeviceStatus {
  state : DeviceState = DeviceState.Unknown

  treatmentElapsedTimeInSeconds: number = 0

  treatmentTimeLeftInSeconds: number = 0

  flags: DeviceStatusFlags = {} as DeviceStatusFlags

  treatmentActualIntensityInPercentage: number = 0

  treatmentConfiguredIntensityInPercentage: number = 0

  pauseRemainingTimeInSeconds: number = 0

  numberOfTreatments: number = 0

  numberOfPauseTreatmentsLeft: number = 0

  constructor(props?: Props) {
    this.state = props?.state || DeviceState.Unknown
    this.treatmentElapsedTimeInSeconds = props?.treatmentElapsedTimeInSeconds || 0
    this.treatmentTimeLeftInSeconds = props?.treatmentTimeLeftInSeconds || 0
    this.flags = props?.flags || {} as DeviceStatusFlags
    this.treatmentActualIntensityInPercentage = props?.treatmentActualIntensityInPercentage || 0
    this.treatmentConfiguredIntensityInPercentage = props?.treatmentConfiguredIntensityInPercentage || 0
    this.pauseRemainingTimeInSeconds = props?.pauseRemainingTimeInSeconds || 0
    this.numberOfTreatments = props?.numberOfTreatments || 0
    this.numberOfPauseTreatmentsLeft = props?.numberOfPauseTreatmentsLeft || 0
  }
}
